//
//  EvaluateMiddleCell.m
//  CenturyCity
//
//  Created by beisheng03 on 2018/1/8.
//  Copyright © 2018年 beisheng. All rights reserved.
//

#import "EvaluateMiddleCell.h"

@interface EvaluateMiddleCell ()
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *bottomMargin;
@property (weak, nonatomic) IBOutlet UITextView *textView;
@property (weak, nonatomic) IBOutlet UILabel *placehoderLabel;
@end


@implementation EvaluateMiddleCell

- (void)awakeFromNib {
    [super awakeFromNib];
    
    self.placehoderLabel.font = MYFONT(15);
    
    self.bottomMargin.constant = 7;
    
    self.placehoderLabel.textColor = placeholderColor;
    
    self.placehoderLabel.text = @"您的评价很重要哦!";
    
    self.textView.scrollEnabled = NO;
    
    self.textView.font = MYFONT(15);
    
    self.placehoderLabel.font = MYFONT(15);
    
    self.textView.autocapitalizationType = UITextAutocapitalizationTypeNone;
    //    [self.textView setAutocapitalizationType:UITextAutocapitalizationTypeNone];
    // Initialization code
    [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(textChange) name:UITextViewTextDidChangeNotification object:self.textView];
    // Initialization code
}


//- (void)setModel:(AddressInfoModel *)model{
//    _model = model;
//
//    if (_model.address.length > 0) {
//
//        self.textView.text = _model.address;
//
//        [self textChange];
//    }
//
//}

- (void)setModel:(GoodEvaluateParm *)model{
    
    _model = model;
    
    
    if (_model.content.length > 0) {
        self.textView.text = _model.content;
        
        [self textChange];
    }
    
    
}


- (void)textChange{
    
    self.model.content = self.textView.text;
    
    self.placehoderLabel.hidden = self.textView.hasText;
    
    [self.tableView beginUpdates];
    
    [self.tableView endUpdates];
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
